﻿; (function (window, undefined, $) {
    $(document).ready(function () {
        var gridopt = {
            url: options.listUrl,
            colModel: [
                    { display: '编号', name: 'Id', width: "5%", sortable: true, hide: true, align: 'left', iskey: true },
                    { display: '众筹项目名称', name: 'ProjectName', width: "7%", sortable: false, align: 'left' },
                    { display: '支持金额(元)', name: 'Amount', width: "7%", sortable: false, align: 'left' },
                    { display: '筹款天数', name: 'CollectDays', width: "7%", sortable: false, align: 'left' },
                    { display: '分类', name: 'ProjectClassName', width: "7%", sortable: false, align: 'left' },
                    { display: '筹款人姓名', name: 'MemberName', width: "7%", sortable: false, align: 'left' },
                    { display: '操作', name: 'Id', width: "13%", sortable: false, align: 'center', process: processOp }
            ],
            sortname: "Id",
            sortorder: "ASC",
            title: false,
            rp: 15,
            usepager: true,
            showcheckbox: false
        };
        var xjgrid = new xjGrid("gridlist", gridopt);

        function processOp(value, cell) {
            var ops = [];
            ops.push("&nbsp;<a title='彩蛋' href='javascript:;'  onclick=\"util.CaiDan('", value, "')\"><i class='fa fa-edit' class='fa fa-trash-o'></i>彩蛋</a>");
            ops.push("&nbsp;<a title='众筹详情' href='javascript:;'  onclick=\"util.ZhongChouDetail('", value, "')\"><i class='fa fa-edit' class='fa fa-trash-o'></i>众筹详情</a>");
            return ops.join("");
        }

        $("#formProOrderList").submit(function () {
            xjgrid.Query(this);
            return false;
        });

        $("#btnSearch").click(function () {
            $("#formProOrderList").submit();
        });

        util.CaiDan = function (orderid) {
            alert("这只是一个彩蛋按钮");
        };

        util.ZhongChouDetail = function (id) {
            var url = options.ZhongChouDetailUrl + "?ProjectId=" + id;
            location.href = url;
        };
    });

})(window, undefined, jQuery);